﻿@model Developer.Entity.RepairProblemDetail
@{
    Layout = "/Areas/Admin/Views/Shared/_PopLayout.cshtml";
}
<article class="page-container">
    <form class="form form-horizontal" id="form-admin-add" action="/admin/repair/editproblemDetail" method="post">
        <input hidden="" value="@Model.Id" id="id" name="typeId" />
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">分类名称：</label>
            <div class="formControls col-xs-8 col-sm-10">
                <input type="text" class="input-text" value="@Model.Name" placeholder="" id="typename" name="typename">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">上级分类：</label>
            <div class="formControls col-xs-8 col-sm-10">
                <select name="parentId" id="s2id_managerid">
                    @{ 
                        if(ViewBag.remain == 0)
                        {
                             <option value="">无</option>
                        }
                        
                    }
                    @{
                        var temp = Developer.Service.RepairProblemService.GetAll().Where(a => a.IsAbort == false);
                        if (temp != null)
                        {
                            if(ViewBag.remain != 0)
                            {
                                var remain = (int)ViewBag.remain;
                                var remain_temp = temp.FirstOrDefault(a => a.Id == remain);
                                <option value="@remain" selected="selected" >@(remain_temp.RepairColor.RepairModel.RepairBrand.RepairType.Name
                        + ">" + remain_temp.RepairColor.RepairModel.RepairBrand.RepairType.Name
                        + ">" + remain_temp.RepairColor.RepairModel.RepairBrand.Name
                        + ">" + remain_temp.RepairColor.RepairModel.Name
                        + ">" + remain_temp.RepairColor.Name
                        + ">" + remain_temp.Name)</option>
                            }
                            foreach (var item in temp.OrderBy(b=>b.RepairColor.Name).OrderBy(a => a.RepairColor.RepairModel.Name))
                            {
                                <option value="@item.Id">@(item.RepairColor.RepairModel.RepairBrand.RepairType.Name
                        + ">" + item.RepairColor.RepairModel.RepairBrand.RepairType.Name
                        + ">" + item.RepairColor.RepairModel.RepairBrand.Name
                        + ">" + item.RepairColor.RepairModel.Name
                        + ">" + item.RepairColor.Name
                        + ">" + item.Name)</option>
                            }
                        }
                    }
                </select>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">设置价值：（单位：元）</label>
            <div class="formControls col-xs-8 col-sm-10">
                <input type="text" class="input-text" value="@Model.Price" placeholder="" id="typename" name="price">
            </div>
        </div>
        <div class="row cl">
            <div class="col-xs-8 col-sm-5 col-xs-offset-4 col-sm-offset-5">
                <input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
            </div>
        </div>
    </form>
</article>
<style>
    .select2-dropdown {
        background-color: #d2f3f0;
    }

    .select2-container .select2-choice {
        margin-left: -15px;
    }

    #s2id_managerid {
        width: 100%;
        padding-right: 0;
    }
</style>
<script type="text/javascript">
    $("#s2id_managerid").select2({
        placeholder: '请选择上级分类，没有请留空'
    });
</script>
